<?php
    $ip = "localhost"; // 数据库服务器地址
    $user = "root";     // 数据库用户名
    $pwd = "123456";     // 数据库密码
    $db = "test";     // 数据库名称
    // 创建连接
    $conn = mysqli_connect($ip, $user, $pwd, $db);
    // 检查连接
    if (!$conn) {
    die("连接失败: " . $conn->connect_error);
}
    echo "连接成功:";

    // $name = "冉浩1";
    // $id = "2";
    $sql = "delete from test where id= 2";

    echo $sql."\n";

    $result = mysqli_query($conn, $sql);
    if($result){
    echo "删除成功！";
} 
    else {
    echo "删除失败:".mysqli_error($conn);
}
    # 关闭连接
    mysqli_close($conn);
?>